package com.andy.service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.andy.dao.IExamScoreDAO;
import com.andy.vo.ExamScoreVO;

@Service
@Transactional
public class ManageStudentScoreService implements IManageStudentScoreService {
	
	@Autowired
	private IExamScoreDAO examScoreDAO;

	@Override
	public List<ExamScoreVO> getAllStudentScore(Map<String, String> conditionMap) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		List<ExamScoreVO> allScores = examScoreDAO.getAllScore(conditionMap);	// 根据条件查询
		if (allScores != null) {
			for (ExamScoreVO score : allScores) {
				if (score.getExamTime() != null) {
					score.setExamTimeString(df.format(score.getExamTime()));	// 转化日期类型成字符串
				}
			}
		}
		return allScores;
	}
	

}
